package IO;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStream;

public class Test {
    public static void main(String[] args) throws Exception {
        //字节输出流
//        OutputStream o = new FileOutputStream("D:/file01.txt");
//        byte[] bytes = "abcdef123456".getBytes();
//        o.write(bytes);
////        o.close();
//
//        //读取一个字节
      FileInputStream f = new FileInputStream("D:/file01.txt");
//        int t;
//        while ((t=f.read())!=-1){
//            System.out.println((char) t);
//        }
        //读取多个字节
        int m;
        byte[] bytes1 = new byte[1024];
        while ((m=f.read(bytes1))!=-1){
            String s = new String(bytes1, 0, m);
            System.out.println(s);
        }

    }
}
